package com.imooc.order.ClientFeign;

import com.imooc.order.common.DecreaseStockInput;
import com.imooc.order.common.ProductInfoOutput;
import com.imooc.order.dataobject.ProductInfo;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 *
 * 利用Feign调用服务接口
 */

@FeignClient(name="product")
public interface ProductClient {


    @GetMapping("/msg")
    String getProductMsg();

    /**
     * 给订单提供的列表
     * @param productIdList
     * @return
     */
    @PostMapping("/product/listForOrder")
    List<ProductInfoOutput> listForOrder(List<String> productIdList);

    /**
     *扣库存
     * @param decreaseStockInputList
     */
    @PostMapping("/product/decreaseStock")
     void  descreaseStock(@RequestBody List<DecreaseStockInput> decreaseStockInputList);


}
